if (!("finalizeConstruction" in ViewPU.prototype)) {
    Reflect.set(ViewPU.prototype, "finalizeConstruction", () => { });
}
export class TableDateType {
    constructor() {
        this.date = '';
        this.value = [];
    }
}
export class EcHealthRecord extends ViewPU {
    constructor(p28, q28, r28, s28 = -1, t28 = undefined, u28) {
        super(p28, r28, s28, u28);
        if (typeof t28 === "function") {
            this.paramsGenerator_ = t28;
        }
        this.__data = new SynchedPropertyObjectTwoWayPU(q28.data, this, "data");
        this.__TableDate = new SynchedPropertySimpleOneWayPU(q28.TableDate, this, "TableDate");
        this.__wt = new ObservedPropertySimplePU(100 / 9, this, "wt");
        this.setInitiallyProvidedValue(q28);
        this.finalizeConstruction();
    }
    setInitiallyProvidedValue(o28) {
        if (o28.wt !== undefined) {
            this.wt = o28.wt;
        }
    }
    updateStateVars(n28) {
        this.__TableDate.reset(n28.TableDate);
    }
    purgeVariableDependenciesOnElmtId(m28) {
        this.__data.purgeDependencyOnElmtId(m28);
        this.__TableDate.purgeDependencyOnElmtId(m28);
        this.__wt.purgeDependencyOnElmtId(m28);
    }
    aboutToBeDeleted() {
        this.__data.aboutToBeDeleted();
        this.__TableDate.aboutToBeDeleted();
        this.__wt.aboutToBeDeleted();
        SubscriberManager.Get().delete(this.id__());
        this.aboutToBeDeletedInternal();
    }
    get data() {
        return this.__data.get();
    }
    set data(l28) {
        this.__data.set(l28);
    }
    get TableDate() {
        return this.__TableDate.get();
    }
    set TableDate(k28) {
        this.__TableDate.set(k28);
    }
    get wt() {
        return this.__wt.get();
    }
    set wt(j28) {
        this.__wt.set(j28);
    }
    initialRender() {
        this.observeComponentCreation2((h28, i28) => {
            Column.create();
            Column.width('100%');
            Column.padding({ top: 0, left: 10, right: 10, bottom: 10 });
        }, Column);
        this.observeComponentCreation2((f28, g28) => {
            Flex.create({
                direction: FlexDirection.Column,
                justifyContent: FlexAlign.Start,
            });
            Flex.width('100%');
            Flex.height('100%');
            Flex.border({
                width: 1,
                color: '#ccc'
            });
        }, Flex);
        {
            this.observeComponentCreation2((z27, a28) => {
                if (a28) {
                    let b28 = new TableHead(this, { wt: this.wt }, undefined, z27, () => { }, { page: "common/public/src/main/ets/components/EcHealthRecord.ets", line: 24 });
                    ViewPU.create(b28);
                    let c28 = () => {
                        return {
                            wt: this.wt
                        };
                    };
                    b28.paramsGenerator_ = c28;
                }
                else {
                    this.updateStateVarsOfChildByElmtId(z27, {
                        wt: this.wt
                    });
                }
            }, { name: "TableHead" });
        }
        this.observeComponentCreation2((w27, x27) => {
            Divider.create();
            Divider.vertical(false);
            Divider.color('#DCDDDC');
        }, Divider);
        {
            this.observeComponentCreation2((q27, r27) => {
                if (r27) {
                    let s27 = new TableRow(this, { wt: this.wt, TableDate: this.TableDate, data: this.__data }, undefined, q27, () => { }, { page: "common/public/src/main/ets/components/EcHealthRecord.ets", line: 29 });
                    ViewPU.create(s27);
                    let t27 = () => {
                        return {
                            wt: this.wt,
                            TableDate: this.TableDate,
                            data: this.data
                        };
                    };
                    s27.paramsGenerator_ = t27;
                }
                else {
                    this.updateStateVarsOfChildByElmtId(q27, {
                        wt: this.wt, TableDate: this.TableDate
                    });
                }
            }, { name: "TableRow" });
        }
        Flex.pop();
        Column.pop();
    }
    rerender() {
        this.updateDirtyElements();
    }
}
class TableHead extends ViewPU {
    constructor(g27, h27, i27, j27 = -1, k27 = undefined, l27) {
        super(g27, i27, j27, l27);
        if (typeof k27 === "function") {
            this.paramsGenerator_ = k27;
        }
        this.__wt = new SynchedPropertySimpleOneWayPU(h27.wt, this, "wt");
        this.headData = [
            { title: '日期' },
            { title: '凌晨' },
            { title: '早餐', child: ['空腹', '后'] },
            { title: '午餐', child: ['前', '后'] },
            { title: '晚餐', child: ['前', '后'] },
            { title: '睡前' },
        ];
        this.setInitiallyProvidedValue(h27);
        this.finalizeConstruction();
    }
    setInitiallyProvidedValue(f27) {
        if (f27.headData !== undefined) {
            this.headData = f27.headData;
        }
    }
    updateStateVars(e27) {
        this.__wt.reset(e27.wt);
    }
    purgeVariableDependenciesOnElmtId(d27) {
        this.__wt.purgeDependencyOnElmtId(d27);
    }
    aboutToBeDeleted() {
        this.__wt.aboutToBeDeleted();
        SubscriberManager.Get().delete(this.id__());
        this.aboutToBeDeletedInternal();
    }
    get wt() {
        return this.__wt.get();
    }
    set wt(c27) {
        this.__wt.set(c27);
    }
    initialRender() {
        this.observeComponentCreation2((a27, b27) => {
            Column.create();
            Column.width('100%');
        }, Column);
        this.observeComponentCreation2((y26, z26) => {
            Flex.create({ direction: FlexDirection.Row });
            Flex.width('100%');
            Flex.backgroundColor('#F4F6F7');
        }, Flex);
        this.observeComponentCreation2((q24, r24) => {
            ForEach.create();
            const s24 = (u24, v24) => {
                const w24 = u24;
                this.observeComponentCreation2((g25, h25) => {
                    If.create();
                    if (w24.child) {
                        this.ifElseBranchUpdateFunction(0, () => {
                            this.observeComponentCreation2((w26, x26) => {
                                Column.create();
                                Column.width(this.wt * 2 + '%');
                            }, Column);
                            this.observeComponentCreation2((u26, v26) => {
                                Row.create();
                            }, Row);
                            this.observeComponentCreation2((s26, t26) => {
                                Text.create(w24.title);
                                Text.textAlign(TextAlign.Center);
                                Text.fontSize(12);
                                Text.width('100%');
                                Text.height(34);
                                Text.fontWeight(500);
                            }, Text);
                            Text.pop();
                            Row.pop();
                            this.observeComponentCreation2((q26, r26) => {
                                Divider.create();
                                Divider.vertical(false);
                                Divider.color('#DCDDDC');
                            }, Divider);
                            this.observeComponentCreation2((o26, p26) => {
                                Row.create();
                            }, Row);
                            this.observeComponentCreation2((w25, x25) => {
                                ForEach.create();
                                const y25 = (a26, b26) => {
                                    const c26 = a26;
                                    this.observeComponentCreation2((m26, n26) => {
                                        Text.create(c26);
                                        Text.width('50%');
                                        Text.textAlign(TextAlign.Center);
                                        Text.fontSize(12);
                                        Text.height(35);
                                        Text.fontWeight(500);
                                    }, Text);
                                    Text.pop();
                                    this.observeComponentCreation2((f26, g26) => {
                                        If.create();
                                        if (b26 == 0) {
                                            this.ifElseBranchUpdateFunction(0, () => {
                                                this.observeComponentCreation2((k26, l26) => {
                                                    Divider.create();
                                                    Divider.vertical(true);
                                                    Divider.height(35);
                                                    Divider.color('#DCDDDC');
                                                }, Divider);
                                            });
                                        }
                                        else {
                                            this.ifElseBranchUpdateFunction(1, () => {
                                            });
                                        }
                                    }, If);
                                    If.pop();
                                };
                                this.forEachUpdateFunction(w25, w24.child, y25, undefined, true, false);
                            }, ForEach);
                            ForEach.pop();
                            Row.pop();
                            Column.pop();
                        });
                    }
                    else {
                        this.ifElseBranchUpdateFunction(1, () => {
                            this.observeComponentCreation2((n25, o25) => {
                                Column.create();
                                Column.width(this.wt + '%');
                            }, Column);
                            this.observeComponentCreation2((l25, m25) => {
                                Text.create(w24.title);
                                Text.textAlign(TextAlign.Center);
                                Text.fontSize(12);
                                Text.width(12);
                                Text.height(70);
                            }, Text);
                            Text.pop();
                            Column.pop();
                        });
                    }
                }, If);
                If.pop();
                this.observeComponentCreation2((z24, a25) => {
                    If.create();
                    if (v24 != 5) {
                        this.ifElseBranchUpdateFunction(0, () => {
                            this.observeComponentCreation2((e25, f25) => {
                                Divider.create();
                                Divider.vertical(true);
                                Divider.color('#DCDDDC');
                                Divider.height(70);
                            }, Divider);
                        });
                    }
                    else {
                        this.ifElseBranchUpdateFunction(1, () => {
                        });
                    }
                }, If);
                If.pop();
            };
            this.forEachUpdateFunction(q24, this.headData, s24, undefined, true, false);
        }, ForEach);
        ForEach.pop();
        Flex.pop();
        Column.pop();
    }
    rerender() {
        this.updateDirtyElements();
    }
}
function initTableDate(a24, b24) {
    const c24 = new Date();
    const d24 = a24 || c24.getMonth() + 1;
    const e24 = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
    const f24 = new Date(c24.getFullYear(), c24.getMonth() + 1, 0).getDate();
    const g24 = [];
    for (let h24 = 1; h24 <= f24; h24++) {
        let i24 = [
            { value: 0, type: 1 },
            { value: 0, type: 1 },
            { value: 0, type: 1 },
            { value: 0, type: 1 },
            { value: 0, type: 1 },
            { value: 0, type: 1 },
            { value: 0, type: 1 },
            { value: 0, type: 1 }
        ];
        let j24 = {
            day: `${d24}/${h24}`,
            week: e24[new Date(`${c24.getFullYear()}-${d24}-${h24}}`).getDay()],
            data: i24
        };
        b24.forEach(l24 => {
            const m24 = `${c24.getFullYear()}-${d24 < 10 ? `0${d24}` : d24}-${h24 < 10 ? `0${h24}` : h24}`;
            if (l24.date == m24) {
                j24.data = l24.value;
            }
        });
        g24.push(j24);
    }
    return g24;
}
class TableRow extends ViewPU {
    constructor(u23, v23, w23, x23 = -1, y23 = undefined, z23) {
        super(u23, w23, x23, z23);
        if (typeof y23 === "function") {
            this.paramsGenerator_ = y23;
        }
        this.__wt = new SynchedPropertySimpleOneWayPU(v23.wt, this, "wt");
        this.__data = new SynchedPropertyObjectTwoWayPU(v23.data, this, "data");
        this.__TableDate = new SynchedPropertySimpleOneWayPU(v23.TableDate, this, "TableDate");
        this.__dateStr = new ObservedPropertySimplePU('', this, "dateStr");
        this.__tabListData = new ObservedPropertyObjectPU([], this, "tabListData");
        this.scroller = new Scroller();
        this.colNum = [1, 2, 3, 4, 5, 6, 7, 8, 9];
        this.setInitiallyProvidedValue(v23);
        this.declareWatch("data", this.dateChange);
        this.declareWatch("TableDate", this.dateChange);
        this.finalizeConstruction();
    }
    setInitiallyProvidedValue(t23) {
        if (t23.dateStr !== undefined) {
            this.dateStr = t23.dateStr;
        }
        if (t23.tabListData !== undefined) {
            this.tabListData = t23.tabListData;
        }
        if (t23.scroller !== undefined) {
            this.scroller = t23.scroller;
        }
        if (t23.colNum !== undefined) {
            this.colNum = t23.colNum;
        }
    }
    updateStateVars(s23) {
        this.__wt.reset(s23.wt);
        this.__TableDate.reset(s23.TableDate);
    }
    purgeVariableDependenciesOnElmtId(r23) {
        this.__wt.purgeDependencyOnElmtId(r23);
        this.__data.purgeDependencyOnElmtId(r23);
        this.__TableDate.purgeDependencyOnElmtId(r23);
        this.__dateStr.purgeDependencyOnElmtId(r23);
        this.__tabListData.purgeDependencyOnElmtId(r23);
    }
    aboutToBeDeleted() {
        this.__wt.aboutToBeDeleted();
        this.__data.aboutToBeDeleted();
        this.__TableDate.aboutToBeDeleted();
        this.__dateStr.aboutToBeDeleted();
        this.__tabListData.aboutToBeDeleted();
        SubscriberManager.Get().delete(this.id__());
        this.aboutToBeDeletedInternal();
    }
    get wt() {
        return this.__wt.get();
    }
    set wt(q23) {
        this.__wt.set(q23);
    }
    get data() {
        return this.__data.get();
    }
    set data(p23) {
        this.__data.set(p23);
    }
    get TableDate() {
        return this.__TableDate.get();
    }
    set TableDate(o23) {
        this.__TableDate.set(o23);
    }
    get dateStr() {
        return this.__dateStr.get();
    }
    set dateStr(n23) {
        this.__dateStr.set(n23);
    }
    get tabListData() {
        return this.__tabListData.get();
    }
    set tabListData(m23) {
        this.__tabListData.set(m23);
    }
    dateChange() {
        const k23 = this.TableDate.split('-');
        const l23 = new Number(k23[1]);
        if (k23 && k23.length >= 2) {
            this.dateStr = l23.toString();
        }
        this.tabListData = initTableDate(this.dateStr, this.data);
    }
    aboutToAppear() {
        if (this.TableDate) {
            this.dateChange();
        }
    }
    initialRender() {
        this.observeComponentCreation2((i23, j23) => {
            Scroll.create(this.scroller);
            Scroll.width('100%');
            Scroll.height('90%');
            Scroll.scrollable(ScrollDirection.Vertical);
        }, Scroll);
        this.observeComponentCreation2((g23, h23) => {
            Column.create();
            Column.width('100%');
        }, Column);
        this.observeComponentCreation2((v19, w19) => {
            ForEach.create();
            const x19 = z19 => {
                const a20 = z19;
                this.observeComponentCreation2((e23, f23) => {
                    Flex.create({ direction: FlexDirection.Row });
                    Flex.width('100%');
                    Flex.height(35);
                }, Flex);
                this.observeComponentCreation2((g20, h20) => {
                    ForEach.create();
                    const i20 = (k20, l20) => {
                        const m20 = k20;
                        this.observeComponentCreation2((w20, x20) => {
                            If.create();
                            if (l20 === 0) {
                                this.ifElseBranchUpdateFunction(0, () => {
                                    this.observeComponentCreation2((i22, j22) => {
                                        If.create();
                                        if (m20 % 2 == 0) {
                                            this.ifElseBranchUpdateFunction(0, () => {
                                                this.observeComponentCreation2((c23, d23) => {
                                                    Column.create();
                                                    Column.width(this.wt + '%');
                                                    Column.height(35);
                                                }, Column);
                                                this.observeComponentCreation2((a23, b23) => {
                                                    Text.create(a20.week);
                                                    Text.fontSize(10);
                                                }, Text);
                                                Text.pop();
                                                this.observeComponentCreation2((y22, z22) => {
                                                    Text.create(a20.day);
                                                    Text.fontSize(12);
                                                    Text.fontColor('#999');
                                                }, Text);
                                                Text.pop();
                                                Column.pop();
                                            });
                                        }
                                        else {
                                            this.ifElseBranchUpdateFunction(1, () => {
                                                this.observeComponentCreation2((s22, t22) => {
                                                    Column.create();
                                                    Column.backgroundColor('#F4F6F7');
                                                    Column.padding({ top: 7 });
                                                    Column.height(35);
                                                    Column.width(this.wt + '%');
                                                }, Column);
                                                this.observeComponentCreation2((q22, r22) => {
                                                    Text.create(a20.week);
                                                    Text.fontSize(10);
                                                    Text.fontWeight(500);
                                                }, Text);
                                                Text.pop();
                                                this.observeComponentCreation2((o22, p22) => {
                                                    Text.create(a20.day);
                                                    Text.fontSize(10);
                                                    Text.fontColor('#999');
                                                }, Text);
                                                Text.pop();
                                                Column.pop();
                                            });
                                        }
                                    }, If);
                                    If.pop();
                                });
                            }
                            else {
                                this.ifElseBranchUpdateFunction(1, () => {
                                    this.observeComponentCreation2((a21, b21) => {
                                        If.create();
                                        if (m20 % 2 == 0) {
                                            this.ifElseBranchUpdateFunction(0, () => {
                                                this.observeComponentCreation2((e22, f22) => {
                                                    Column.create();
                                                    Column.width(this.wt + '%');
                                                    Column.height(35);
                                                    Column.justifyContent(FlexAlign.Center);
                                                }, Column);
                                                this.observeComponentCreation2((u21, v21) => {
                                                    If.create();
                                                    if (a20.data[l20 - 1].type == 2) {
                                                        this.ifElseBranchUpdateFunction(0, () => {
                                                            this.observeComponentCreation2((c22, d22) => {
                                                                Text.create(!a20.data[l20 - 1].value ? '' : String(a20.data[l20 - 1].value));
                                                                Text.fontSize(14);
                                                                Text.fontColor('#0398FF');
                                                            }, Text);
                                                            Text.pop();
                                                        });
                                                    }
                                                    else {
                                                        this.ifElseBranchUpdateFunction(1, () => {
                                                            this.observeComponentCreation2((y21, z21) => {
                                                                Text.create(!a20.data[l20 - 1].value ? '' : String(a20.data[l20 - 1].value));
                                                                Text.fontSize(14);
                                                                Text.fontColor('#FFAB2D');
                                                            }, Text);
                                                            Text.pop();
                                                        });
                                                    }
                                                }, If);
                                                If.pop();
                                                Column.pop();
                                            });
                                        }
                                        else {
                                            this.ifElseBranchUpdateFunction(1, () => {
                                                this.observeComponentCreation2((p21, q21) => {
                                                    Column.create();
                                                    Column.backgroundColor('#F4F6F7');
                                                    Column.height(35);
                                                    Column.justifyContent(FlexAlign.Center);
                                                    Column.width(this.wt + '%');
                                                }, Column);
                                                this.observeComponentCreation2((f21, g21) => {
                                                    If.create();
                                                    if (a20.data[l20 - 1].type == 2) {
                                                        this.ifElseBranchUpdateFunction(0, () => {
                                                            this.observeComponentCreation2((n21, o21) => {
                                                                Text.create(!a20.data[l20 - 1].value ? '' : String(a20.data[l20 - 1].value));
                                                                Text.fontSize(14);
                                                                Text.fontColor('#0398FF');
                                                            }, Text);
                                                            Text.pop();
                                                        });
                                                    }
                                                    else {
                                                        this.ifElseBranchUpdateFunction(1, () => {
                                                            this.observeComponentCreation2((j21, k21) => {
                                                                Text.create(!a20.data[l20 - 1].value ? '' : String(a20.data[l20 - 1].value));
                                                                Text.fontSize(14);
                                                                Text.fontColor('#FFAB2D');
                                                            }, Text);
                                                            Text.pop();
                                                        });
                                                    }
                                                }, If);
                                                If.pop();
                                                Column.pop();
                                            });
                                        }
                                    }, If);
                                    If.pop();
                                });
                            }
                        }, If);
                        If.pop();
                        this.observeComponentCreation2((p20, q20) => {
                            If.create();
                            if (l20 != 8) {
                                this.ifElseBranchUpdateFunction(0, () => {
                                    this.observeComponentCreation2((u20, v20) => {
                                        Divider.create();
                                        Divider.vertical(true);
                                        Divider.color('#DCDDDC');
                                    }, Divider);
                                });
                            }
                            else {
                                this.ifElseBranchUpdateFunction(1, () => {
                                });
                            }
                        }, If);
                        If.pop();
                    };
                    this.forEachUpdateFunction(g20, this.colNum, i20, undefined, true, false);
                }, ForEach);
                ForEach.pop();
                Flex.pop();
                this.observeComponentCreation2((e20, f20) => {
                    Divider.create();
                    Divider.color('#DCDDDC');
                }, Divider);
            };
            this.forEachUpdateFunction(v19, this.tabListData, x19);
        }, ForEach);
        ForEach.pop();
        Column.pop();
        Scroll.pop();
    }
    rerender() {
        this.updateDirtyElements();
    }
}
